﻿using System.IO;

namespace Sync.File
{
    internal static class HelperClass
    {
        public static bool IsNull<TElementOne>(this TElementOne item)
        {
            return item == null;
        }

        /// <summary>
        /// Changes what types of files the watcher looks at
        /// </summary>
        /// <param name="watcher"></param>
        /// <param name="filter"></param>
        public static void LookAt(this FileSystemWatcher watcher, NotifyFilters filter)
        {
            watcher.NotifyFilter = filter;
        }

        /// <summary>
        /// Releases resources on the Watcher sent in
        /// </summary>
        /// <param name="watcher">the watcher that is releasing resources</param>
        public static void ReleaseResources(this FileSystemWatcher watcher)
        {
            watcher.EnableRaisingEvents = false;
            watcher = null;
        }
    }
}